[t:/]$ 지식_

gcc에서 jpg, binary 같이 link

2012/02/24

http://stackoverflow.com/questions/4864866/c-c-with-gcc-statically-add-resource-files-to-executable-library

예전에도 다룬 적이 있는데..

이하 인용..

I have used objcopy (GNU binutils) to link the binary data from a file foo-data.bin into the data section of the executable:

objcopy -B i386 -I binary -O elf32-i386 foo-data.bin foo-data.o This gives you a foo-data.o object file which you can link into your executable. The C interface looks something like

/** created from binary via objcopy */
extern uint8_t foo_data[] asm("_binary_foo_data_bin_start");
extern uint8_t foo_data_size[] asm("_binary_foo_data_bin_size");
extern uint8_t foo_data_end[] asm("_binary_foo_data_bin_end");

바로 전역변수 쓰면 됨..

gcc -c a.c
gcc -o a.o foo-data.o
로딩 타임과 실행 성능의 상관 관계를 잘 고려해서 dl_open과 잘 조합할 필요가 있다.

arm 에서 리소스 청크를 얻으려면 이렇게 되겠죠.

arm-none-eabi-objcopy -B arm -I binary -O elf32-littlearm m4 m4.o

빠른 로딩을 위한 기법들은 많다.

하지만 현실은 시궁창..





공유하기













[t:/] is not "technology - root". dawnsea, rss